public class RobotAleatoire extends Robot
{
	//There is NO constructor inheritance in Java. If there were any, 
	//something like "new FileInputStream()" would be valid (by default) 
	//because Object has a default constructor.
	//If super(...) is not used, super's default constructor is called automatically.
	public RobotAleatoire(ILaby lab)
	{
		super(lab);
	}

	public int findExit()
	{
		int ct=0, sel; //moves done
		int[] dirs = new int[]{Labyrinthe.UP, Labyrinthe.RIGHT, Labyrinthe.DOWN, Labyrinthe.LEFT};
		while (!lab.isExit()) //not found (yet)
		{
			while (true)
			{
				sel = (int)(Math.random()*4);
				if (lab.go(dirs[sel]))
					break; //found a way to move
			}
			ct++;
		}

		return ct;
	}
}
